package b4.view
{
	import b4.view.component.main.MainFuncBar;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class MainFuncBarMediator extends Mediator implements IMediator
	{
		public static const NAME:String = 'MainFuncBarMediator';
		public static const SHOW_PACKAGE:String = 'ShowPackage';
		public static const SHOW_SMITHY:String = 'ShowSmithy';
		public static const SHOW_HUMAN_BEING:String = 'ShowHumanBeing';
		
		public function MainFuncBarMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
		}
		
		override public function listNotificationInterests():Array
		{
			return [
			];
		}
		
		override public function handleNotification(notification:INotification):void
		{
			var name:String = notification.getName();
			var body:Object = notification.getBody();
			
			switch ( name )
			{
			}
		}
		
		override public function onRegister():void
		{
			sendNotification(ApplicationMediator.ADD_CHILD, viewComponent);
			mainFuncBar.blackSmithIcon.addEventListener(MouseEvent.CLICK, onBlackSmithIconClick);
			mainFuncBar.packageIcon.addEventListener(MouseEvent.CLICK, onPackageIconClick);
			mainFuncBar.humanBeingIcon.addEventListener(MouseEvent.CLICK, onHumanBeingIconClick);
		}
		
		private function onPackageIconClick(event:Event):void
		{
			sendNotification(MainFuncBarMediator.SHOW_PACKAGE);
		}
		
		private function onBlackSmithIconClick(event:Event):void
		{
			sendNotification(MainFuncBarMediator.SHOW_SMITHY);
		}
		
		private function onHumanBeingIconClick(event:Event):void
		{
//			var popMessage:PopMessage = new PopMessage("尚未开启！");
//			sendNotification(ApplicationMediator.ADD_CHILD, popMessage);
			sendNotification(MainFuncBarMediator.SHOW_HUMAN_BEING);
		}
		
		private function get mainFuncBar():MainFuncBar
		{
			return viewComponent as MainFuncBar;
		}
	}
}